//
//  ZYCCourseRegistrationDetailsCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/26.
//

#import "ZYCCourseRegistrationDetailsCell.h"
#import "ZYCCourseRegistrationDetailModel.h"

@interface ZYCCourseRegistrationDetailsCell ()

@property (nonatomic, strong) UIImageView *iconView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@end
@implementation ZYCCourseRegistrationDetailsCell

- (void)setDict:(NSDictionary *)dict{
    _dict = dict;
    _titleLabel.text = dict[@"title"];
    _timeLabel.text = dict[@"time"];
}

- (void)setModel:(ZYCCourseStudentInfoModel *)model{
    _model = model;
    _titleLabel.text = [NSString stringWithFormat:@"%@/%@/%@",model.gradeChinese,model.className,model.name];
    _timeLabel.text = model.enrollTime;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.iconView];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.timeLabel];
    
        [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(40.0f, 40.0f));
        }];

        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.iconView.mas_right).offset(10.0f);
            make.top.equalTo(self.iconView);
        }];

        [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.iconView.mas_right).offset(10.0f);
            make.bottom.equalTo(self.iconView);
        }];
        
    }
    return self;
}
- (UIImageView *)iconView {
    if (!_iconView) {
        _iconView = [[UIImageView alloc] init];
        _iconView.image = [UIImage imageNamed:@"headerPlace"];
        _iconView.layer.cornerRadius = 20.0f;
        _iconView.layer.masksToBounds = YES;
    }
    return _iconView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 18) titleColor:HEX_RGB(kTitleThemeColor) textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 14) titleColor:HEX_RGB(@"#888888") textAlignment:ZZTextAlignmentRight];
    }
    return _timeLabel;
}


@end
